package com.dianrui.qiyouriding.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dianrui.qiyouriding.R;
import com.dianrui.qiyouriding.activity.ViolationDetailsActivity;
import com.dianrui.qiyouriding.bean.BikePointVehicle;
import com.dianrui.qiyouriding.bean.ViolationModel;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ViolationListAdapter extends BaseQuickAdapter<ViolationModel, BaseViewHolder> {

    private Context context;


    public ViolationListAdapter(Context context, int layoutResId, @Nullable List<ViolationModel> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ViolationModel violationModel) {
        helper.setText(R.id.time, violationModel.create_time);
        String showNumber = "车牌编号:" + violationModel.vehicle_number;
        helper.setText(R.id.car_number, showNumber);
        switch (violationModel.state) {
            case "0":
                helper.setText(R.id.status, violationModel.status_name);
                helper.setTextColor(R.id.status, context.getResources().getColor(R.color.white));
                helper.setBackgroundRes(R.id.status, R.drawable.violation_red_shape);
                break;
            case "1":
                helper.setText(R.id.status, violationModel.status_name);
                helper.setTextColor(R.id.status, context.getResources().getColor(R.color.white));
                helper.setBackgroundRes(R.id.status, R.drawable.violation_red_shape);
                break;
            case "2":
                helper.setText(R.id.status, violationModel.status_name);
                helper.setTextColor(R.id.status, context.getResources().getColor(R.color.white));
                helper.setBackgroundRes(R.id.status, R.drawable.violation_red_shape);
                break;
            case "3":
                helper.setText(R.id.status, violationModel.status_name);
                helper.setTextColor(R.id.status, context.getResources().getColor(R.color.black));
                helper.setBackgroundRes(R.id.status, R.drawable.green_gradient);
                break;
            case "4":
                helper.setText(R.id.status, violationModel.status_name);
                helper.setTextColor(R.id.status, context.getResources().getColor(R.color.white));
                helper.setBackgroundRes(R.id.status, R.drawable.gray_shape);
                break;

            default:
                break;
        }

    }
}
